// 组件样式文件

// 容器样式
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.content-container {
  background-color: #fff;
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

// 卡片样式
.card {
  background-color: #fff;
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;

  &:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.15);
  }

  .card-img {
    width: 100%;
    height: 180px;
    overflow: hidden;

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      transition: transform 0.5s;
    }

    &:hover img {
      transform: scale(1.05);
    }
  }

  .card-body {
    padding: 15px;
  }

  .card-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .card-price {
    font-size: 18px;
    color: #f56c6c;
    margin-bottom: 8px;
  }

  .card-desc {
    font-size: 12px;
    color: #909399;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}

// 按钮样式
.btn {
  display: inline-block;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;

  &:disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }

  &.btn-primary {
    background-color: #409eff;
    color: #fff;

    &:hover:not(:disabled) {
      background-color: #66b1ff;
    }
  }

  &.btn-success {
    background-color: #67c23a;
    color: #fff;

    &:hover:not(:disabled) {
      background-color: #85ce61;
    }
  }

  &.btn-danger {
    background-color: #f56c6c;
    color: #fff;

    &:hover:not(:disabled) {
      background-color: #f78989;
    }
  }

  &.btn-default {
    background-color: #fff;
    color: #606266;
    border: 1px solid #dcdfe6;

    &:hover:not(:disabled) {
      color: #409eff;
      border-color: #c6e2ff;
      background-color: #ecf5ff;
    }
  }

  &.btn-small {
    padding: 4px 8px;
    font-size: 12px;
  }

  &.btn-large {
    padding: 12px 24px;
    font-size: 16px;
  }
}

// 表单样式
.form-group {
  margin-bottom: 20px;

  .form-label {
    display: inline-block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #606266;
  }

  .form-input,
  .form-select,
  .form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;

    &:focus {
      outline: none;
      border-color: #409eff;
    }

    &:disabled {
      background-color: #f5f7fa;
      border-color: #e4e7ed;
      color: #c0c4cc;
    }
  }

  .form-textarea {
    resize: vertical;
    min-height: 80px;
  }
}

// 分页样式
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 30px;

  .page-item {
    margin: 0 5px;

    .page-link {
      display: inline-block;
      width: 32px;
      height: 32px;
      line-height: 32px;
      text-align: center;
      border: 1px solid #dcdfe6;
      border-radius: 4px;
      color: #606266;
      transition: all 0.3s;

      &:hover {
        color: #409eff;
        border-color: #c6e2ff;
      }

      &.active {
        color: #fff;
        background-color: #409eff;
        border-color: #409eff;
      }

      &.disabled {
        color: #c0c4cc;
        border-color: #e4e7ed;
        background-color: #f5f7fa;
        cursor: not-allowed;
      }
    }
  }
}

// 头部样式
.header {
  height: 60px;
  background-color: #fff;
  border-bottom: 1px solid #e4e7ed;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;

  .header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
  }

  .logo {
    font-size: 20px;
    font-weight: 600;
    color: #409eff;
  }

  .nav {
    display: flex;

    .nav-item {
      margin-left: 30px;
      font-size: 16px;
      color: #606266;
      position: relative;

      &:hover {
        color: #409eff;
      }

      &.active {
        color: #409eff;
      }

      &.active::after {
        content: '';
        position: absolute;
        bottom: -20px;
        left: 0;
        width: 100%;
        height: 2px;
        background-color: #409eff;
      }
    }
  }

  .user-actions {
    display: flex;
    align-items: center;

    .action-item {
      margin-left: 20px;
      position: relative;

      .badge {
        position: absolute;
        top: -8px;
        right: -8px;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        font-size: 12px;
        color: #fff;
        background-color: #f56c6c;
        border-radius: 8px;
        text-align: center;
        line-height: 16px;
      }
    }
  }
}

// 底部样式
.footer {
  background-color: #fff;
  border-top: 1px solid #e4e7ed;
  padding: 40px 0;
  margin-top: 40px;

  .footer-container {
    display: flex;
    justify-content: space-between;
  }

  .footer-column {
    flex: 1;

    .footer-title {
      font-size: 16px;
      font-weight: 500;
      margin-bottom: 20px;
      color: #303133;
    }

    .footer-links {
      display: flex;
      flex-direction: column;

      .footer-link {
        margin-bottom: 10px;
        color: #606266;

        &:hover {
          color: #409eff;
        }
      }
    }
  }

  .footer-bottom {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e4e7ed;
    color: #909399;
  }
}

// 购物车样式
.cart-item {
  display: flex;
  padding: 15px 0;
  border-bottom: 1px solid #e4e7ed;

  .cart-item-checkbox {
    margin-right: 15px;
    align-self: center;
  }

  .cart-item-image {
    width: 80px;
    height: 80px;
    margin-right: 15px;

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }

  .cart-item-info {
    flex: 1;
    min-width: 0;

    .cart-item-name {
      font-size: 14px;
      color: #303133;
      margin-bottom: 8px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .cart-item-attrs {
      font-size: 12px;
      color: #909399;
      margin-bottom: 8px;
    }
  }

  .cart-item-price {
    font-size: 16px;
    color: #f56c6c;
    margin-right: 20px;
  }

  .cart-item-quantity {
    display: flex;
    align-items: center;
    margin-right: 20px;

    .quantity-btn {
      width: 20px;
      height: 20px;
      border: 1px solid #dcdfe6;
      background-color: #fff;
      cursor: pointer;
      text-align: center;
      line-height: 20px;
    }

    .quantity-input {
      width: 40px;
      height: 20px;
      border: 1px solid #dcdfe6;
      border-left: none;
      border-right: none;
      text-align: center;
      outline: none;
    }
  }

  .cart-item-total {
    font-size: 16px;
    color: #f56c6c;
    margin-right: 20px;
  }

  .cart-item-action {
    color: #909399;
    cursor: pointer;

    &:hover {
      color: #f56c6c;
    }
  }
}

// 订单样式
.order-item {
  background-color: #fff;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);

  .order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #f5f7fa;
    border-bottom: 1px solid #e4e7ed;

    .order-time {
      font-size: 12px;
      color: #909399;
    }

    .order-status {
      font-size: 14px;
      color: #409eff;
    }
  }

  .order-body {
    padding: 20px;
  }

  .order-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #fafafa;
    border-top: 1px solid #e4e7ed;

    .order-total {
      font-size: 16px;
      color: #f56c6c;
      font-weight: 500;
    }

    .order-actions {
      display: flex;

      .btn {
        margin-left: 10px;
      }
    }
  }
}